home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* */
- /* ------------ Bit-Bucket Software <no-Inc> */
- /* \ 10001101 / Writers and Distributors of */
- /* \ 011110 / No-Cost<no-tm> Software. */
- /* \ 1011 / */
- /* ------ */
- /* */
- /* Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello */
- /* */
- /* */
- /* This module was originally written by Vince Perriello */
- /* */
- /* */
- /* BinkleyTerm ANSI mapping */
- /* */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the MAKEFILE and BT.C, and also contained in the file LICENSE.210. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHORS */
- /* AT THE ADDRESSES LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO */
- /* USE THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE */
- /* BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU */
- /* ARE ABLE TO REACH WITH THE AUTHORS. */
- /* */
- /* */
- /* The Authors can be reached at the following addresses: */
- /* */
- /* Robert C. Hartman Vincent E. Perriello */
- /* Spark Software VEP Software */
- /* 427-3 Amherst Street 111 Carroll Street */
- /* CS2032, Suite 232 Naugatuck, CT 06770 */
- /* Nashua, NH 03061 */
- /* */
- /* FidoNet 1:132/101 FidoNet 1:141/491 */
- /* Data (603) 888-8179 Data (203) 729-7569 */
- /* */
- /* Please feel free to contact us at any time to share your comments */
- /* about our software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
- #include <string.h>
-
- #include "com.h"
- #include "xfer.h"
- #include "zmodem.h"
- #include "keybd.h"
- #include "sbuf.h"
- #include "sched.h"
- #include "externs.h"
- #include "prototyp.h"
-
-
- /*--------------------------------------------------------------------------*/
- /* */
- /* ansi_map() -- map function key into an ANSI escape sequence if we have */
- /* one to correspond to the key. The "emulation" is VT100-type, we map the */
- /* arrow keys to the ANSI escape sequences for up, down, right and left, */
- /* and we map the function keys into the VT100 keypad, assuming application */
- /* mode, like Procomm. That is, we take the VT100 keypad, split it in two */
- /* vertically, and use the F-keys to represent the left side, and the */
- /* "shifted" F-keys to represent the right side. */
- /* */
- /* The result, if any, is transmitted to the host. */
- /* */
- /*--------------------------------------------------------------------------*/
- /* ESC Seq IBM key Scan code VT100 key */
-
- static char *ansi_seq[] = {
- "\033OP", /* F1 3b00 PF1 */
- "\033OQ", /* F2 3c00 PF2 */
- "\033Ow", /* F3 3d00 keypad '7' */
- "\033Ox", /* F4 3e00 keypad '8' */
- "\033Ot", /* F5 3f00 keypad '4' */
- "\033Ou", /* F6 4000 keypad '5' */
- "\033Oq", /* F7 4100 keypad '1' */
- "\033Or", /* F8 4200 keypad '2' */
- "\033Op", /* F9 4300 keypad '0' */
- "\033Op", /* F10 4400 keypad '0' */
- "", /* 4500 */
- "", /* 4600 */
- "", /* 4700 */
- "\033[A", /* Up Arrow 4800 Up Arrow */
- "", /* 4900 */
- "", /* 4a00 */
- "\033[D", /* Left Arrow 4b00 Left Arrow */
- "", /* 4c00 */
- "\033[C", /* Right Arrow 4d00 Right Arrow */
- "", /* 4e00 */
- "", /* 4f00 */
- "\033[B", /* Down Arrow 5000 Down Arrow */
- "", /* 5100 */
- "", /* 5200 */
- "", /* 5300 */
- "\033OR", /* Shift-F1 5400 PF3 */
- "\033OS", /* Shift-F2 5500 PF4 */
- "\033Oy", /* Shift-F3 5600 keypad '9' */
- "\033Om", /* Shift-F4 5700 keypad '-' */
- "\033Ov", /* Shift-F5 5800 keypad '6' */
- "\033Ol", /* Shift-F6 5900 keypad ',' */
- "\033Os", /* Shift-F7 5a00 keypad '3' */
- "\033OM", /* Shift-F8 5b00 keypad 'Enter' */
- "\033On", /* Shift-F9 5c00 keypad '.' */
- "\033OM", /* Shift-F10 5d00 keypad 'Enter' */
- ""
- };
-
- void ansi_map (ScanVal)
- unsigned ScanVal;
- {
- register KeyCode;
- register char *s;
-
- KeyCode = ScanVal >> 8; /* Isolate to key scan code */
- if ((KeyCode < 0x3b) || (KeyCode > 0x5d))
- return; /* Not in range, give up */
- s = ansi_seq[KeyCode - 0x3b]; /* Index to our sequence */
- SENDCHARS (s, strlen (s), 0); /* Send the mapped string */
- }
-